<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <h1>{{num |cheng | two }}</h1>
        <ul>
            <li v-for="(item,index) in list" :key="index">{{item |jia}}</li>
        </ul>
    </div>
    <script src="./vue.js"></script>
    <script>
        // Vue的过滤器  过滤处理数据
        // 过滤器的调用 {{data| 过滤器名|过滤器}}

        Vue.filter('two', function(val) {
            return val.toFixed(2)
        })
        new Vue({
            el: "#app",
            data() {
                return {
                    num: 1.1231923,
                    list: ["1", "12", "243"]
                }
            },
            components: {},
            directives: {},
            // 局部过滤器
            filters: {
                cheng(val) {
                    return val * 100
                },
                jia(val) { //val  要处理的数据
                    return val + "元"
                }
            }
        })
    </script>
</body>

</html>